//
// Created by liushuai on 19-3-16.
//
#include "shell_sort.h"
using namespace std;
void insert_span(a,h,n)
{
    for(int i=h;i<n;i+=h)
    {
        if(a[i+h]<a[i])
            swap(a[i,i+h]);
    }

}
vector<int>& shell_sort(vector<int>& a)
{
    if(a.size()<2)
        return a;
    else{
        int n = a.size();
        for(int span = n/2;span<n;span/=2)
        {
            for(int i=0;i<span;i++)
            {
                if(a[i]<a[i+span])
                    swap(a[i],a[i+span]);
            }
        }
        return a;
    }
}